﻿using Azure.Core;
using FoodModel;
using J.FoodManageGet.Application.Command.DishesCommand;
using J.FoodManageGet.Application.Command.GroupingCommand;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace J.FoodManageGet.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class GroupingController : ControllerBase
    {
        private readonly IMediator _mediator;

        public GroupingController(IMediator mediator)
        {
            _mediator = mediator;
        }

        /// <summary>
        /// 菜品分组反填
        /// </summary>
        [HttpPost]
        public async Task<GroupingModel> GroupingBack(GroupingBackCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 菜品名称反填
        /// </summary>
        [HttpPost]
        public async Task<List<GroupingDto>> Grouping(GroupingCommand command)
        {
            return await _mediator.Send(command);
        }
        /// <summary>
        /// 菜品分组显示
        /// </summary>
        [HttpPost]
        public async Task<List<GroupingModel>> GroupingShow(GroupingShowCommand command)
        {
            return await _mediator.Send(command);
        }
    }
}
